﻿Imports System.Web
Imports System.Web.Routing
Imports System.Web.UI
Imports System.Web.Compilation

Public Class RouteHandler
    Implements System.Web.Routing.IRouteHandler

    Private xFileName As String

    Public Sub New(pFileName As String)
        xFileName = pFileName
    End Sub

    Public Function GetHttpHandler(requestContext As System.Web.Routing.RequestContext) _
                        As System.Web.IHttpHandler Implements System.Web.Routing.IRouteHandler.GetHttpHandler

        HttpContext.Current.Items("RouteData") = requestContext.RouteData
        Return DirectCast(BuildManager.CreateInstanceFromVirtualPath(xFileName, GetType(Page)), Page)

    End Function
End Class
